<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<html>
<head>
	<title>库区管理</title>
	
	<script>
		$(document).ready(function() {
			//聚焦第一个输入框
			$("#storage_name").focus();
			//为inputForm注册validate函数
			$("#inputForm").validate();
		});
	</script>
</head>

<body>
<section class="content">
<div class="row">
		<div class="col-md-12">

			<!-- Primary box -->
			<div class="box box-solid box-primary">
				<div class="box-header">
					<i class="fa fa-edit"></i>
					<h3 class="box-title">管理库区</h3>
					<div class="box-tools pull-right">
						<button class="btn btn-primary btn-sm" data-widget="collapse">
							<i class="fa fa-minus"></i>
						</button>
					</div>
				</div>
				<div class="box-body">
	<form id="inputForm" action="${ctx}/v2/storage/${action}" method="post" class="form-horizontal">
		<input type="hidden" name="id" value="${storage.id}"/>
		<fieldset>
			<div class="form-group">
				<label for="storage_name" class="col-sm-3 control-label">库区名称:</label>
				<div class="col-sm-6">
					<input type="text" id="storage_name" name="name"  value="${storage.name}" class="form-control input-large required" minlength="1"/>
				</div>
			</div>
			<div class="form-group">
				<label for="storage_code" class="col-sm-3 control-label">库区编码:</label>
				<div class="col-sm-6">
					<input type="text" id="storage_code" name="code"  value="${storage.code}" class="form-control input-large required" minlength="1"/>
					<font color="red">仓库编码+商家编码</font>
				</div>
			</div>
			<div class="form-group">
				<label for="storage_num" class="col-sm-3 control-label">库位数:</label>
				<div class="col-sm-6">
					<input type="text" id="storage_num" name="num"  value="${storage.num}" class="form-control input-large required" minlength="1"/>
				</div>
			</div>
			<div class="form-group">
				<label for="storage_type" class="col-sm-3 control-label">库区类型:</label>
				<div class="col-sm-6">
					<select id="storage_type" name="type" class="form-control">
						<option value="-1"></option>
						<option value="simple" <c:if test="${storage.type eq 'simple'}">selected="selected"</c:if>>简易库区</option>
						<!--<option value="commodity" <c:if test="${storage.type eq 'complex'}">selected="selected"</c:if>>复杂库区</option>
					--></select>
				</div>
			</div>
			<div class="form-group">
				<label for="storage_areagroupId" class="col-sm-3 control-label">所属分仓:</label>
				<div class="col-sm-6">
					<select id="storage_areagroupId" name="areagroupId" class="form-control" >
						<option value="-1"></option>
						<c:forEach items="${areaGroups}" var="areaGroup">
							<option value="${areaGroup.id}" <c:if test="${not empty storage.areaGroup and storage.areaGroup.id eq areaGroup.id}">selected="selected"</c:if>>${areaGroup.groupName}</option>
						</c:forEach>
					</select>
				</div>
			</div>
			<!--<c:if test="${not empty storagePartitions}">
			<div class="form-group">
				<label for="storage_areagroupId" class="col-sm-3 control-label">所有分区:</label>
				<div class="col-sm-6">
					<c:forEach items="${storagePartitions}" var="storagePartition">
						    <div class="btn-group dropup">
						    	<a href="#" role="button" onclick="" class="btn" data-toggle="modal">分区${storagePartition.partition_name}</a>
							    <button class="btn dropdown-toggle" data-toggle="dropdown">
							    	<span class="caret"></span>
							    </button>
							    <ul class="dropdown-menu">
							    	<li><a href="${ctx}/storagepartition/${storagePartition.id}">查看</a></li>
							    	<li><a href="${ctx}/storagepartition/${storagePartition.id}">删除</a></li>
							    </ul>
							 </div>
							 <br />
					</c:forEach>
				</div>
			</div>
			</c:if>
			--><div class="modal-footer bg-gray">
				<input id="submit_btn" class="btn btn-primary" type="submit" value="提交"/>&nbsp;	
				<input id="cancel_btn" class="btn" type="button" value="返回" onclick="history.back()"/>
			</div>
		</fieldset>
	</form>
	</div>
			</div>
			</div>
			</div>
			</section>
</body>
</html>
